package processor;
import java.util.ArrayList;

import cache.Cache;
import cache.CacheImpl;

public class ProcessorClass {
	private Cache cache = CacheImpl.getCacheObject();
	
	
	
	private ArrayList<Object> getRowData(String tableName,int primaryKey){
		
		return cache.getValue(primaryKey, tableName);
		
	}
	
	private void reset(String tableName){
		cache.resetCache(tableName);
	}
	
 private void updateDatabase(String tableName,ArrayList<Object> columneValue,int primaryKey){
		cache.putValue(primaryKey, columneValue, tableName);
 }
	
	public static void main(String[] args)  {
		ProcessorClass pc = new ProcessorClass();
		//Getting data from cache
		ArrayList<Object> rowData = pc.getRowData("user_personal_detail",1);
		for(Object obj : rowData){
			System.out.println(obj);
		}
		
		// Updating cache
		ArrayList<Object> object= new ArrayList<Object>();
		object.add(45);
		object.add("Teseeet");
		object.add(39);
		pc.updateDatabase("user_record",object,33);
		
		//Reset cache
		pc.reset("user_record");
		
		
		
		
	}
	
	
}
